package com.thinkgem.jeesite.modules.bus.web;

import com.thinkgem.jeesite.common.config.Global;
import com.thinkgem.jeesite.common.persistence.Page;
import com.thinkgem.jeesite.modules.sys.entity.User;
import com.thinkgem.jeesite.modules.sys.service.SystemService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * @ClassName UserManageController
 * @Description: 用户管理
 * @Author my
 * @Date 2019/7/22
 * @Version V1.0
 **/
@Controller
@RequestMapping(value = "${adminPath}/bus/userManage")
public class UserManageController {

    @Autowired
    private SystemService systemService;
    /*
     * @MethodName: index
     * @Description: 左侧机构树
     * @Param: []
     * @Return: java.lang.String
     * @Author: my
     * @Date: 2019/7/22
    **/
    @RequiresPermissions("bus:userManage:view")
    @RequestMapping(value = "index")
    public String index() {
        return "modules/bus/userManageIndex";
    }
    /*
     * @MethodName: list
     * @Description: 管理员用户列表
     * @Param: [user, request, response, model]
     * @Return: java.lang.String
     * @Author: my
     * @Date: 2019/7/22
    **/
    @RequiresPermissions("bus:userManage:view")
    @RequestMapping(value = {"list", ""})
    public String list(User user, HttpServletRequest request, HttpServletResponse response, Model model) {
        user.setUserType("4");
        Page<User> page = systemService.userManageList(new Page<User>(request, response), user);
        model.addAttribute("page", page);
        return "modules/bus/userManageList";
    }
}
